<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 统计各位数字都不同的数字个数 -->
    <script>
      var countNumbersWithUniqueDigits = function (n) {
        if (n === 0) {
          return 1
        }
        if (n === 1) {
          return 10
        }
        let pre = 9
        let next = 0
        let s = 10
        for (let i = 1; i < n; i++) {
          next = pre * (10 - i)
          s += next
          pre = next
        }
        return s
      }
      console.log(countNumbersWithUniqueDigits(2))
    </script>
  </body>
</html>
